package cn.boundtw2.Stream02;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class Demo02InoutStream {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("IOliu\\b.txt");
       /* byte[] bytes = new byte[2];
        int len = fis.read(bytes);
        System.out.println(len);
        System.out.println(new String(bytes));//AB

        len = fis.read(bytes);
        System.out.println(len);//1
        System.out.println(new String(bytes));//CD

        len = fis.read(bytes);
        System.out.println(len);//1
        System.out.println(new String(bytes));//ED


        len = fis.read(bytes);
        System.out.println(len);//-1
        System.out.println(new String(bytes));//ED
*/
        byte[] bytes = new byte[1024];
        int len = 0;
        while ((len = fis.read(bytes))!=-1){
            System.out.println(new String(bytes,0,len));
        }
        fis.close();
    }

}
